<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>我的伙伴</title>
		<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
		<style>
		</style>
		<script>
			function getUser(){
                var username = $("#username").val();
                var password = $("#password").val();
				$.ajax({
					type:"post",
					url:"/login",
					dataType:"json",
					contentType:"application/json; charset=UTF-8",
					data:"{\"username\":\""+username+"\", \"password\":\""+password+"\"}",
					success:function(data){
						if(data.result == "success"){
							window.location.href = "a.html";
						}
					}
				});


			}
		</script>
	</head>
	<body>
		<input type="text" name="username" id="username" placeholder="账号："  />
		<input type="text" name="password" id="password" placeholder="密码："  />
		<a onclick="getUser()">登录</a>
	</body>
</html>
